<?php
/**
 * +--------------------------------------------------------+
 * @Created by PhpStorm.
 * @Category IndexController.php
 * @Depiction:
 * Author: hwy
 * Date: 2020/5/28  16:28
 * +--------------------------------------------------------+
 */

namespace App\Http\Controllers\Admin;

use App\Http\Controllers\Controller;
use App\Models\AdminNav;
use App\Models\Stock;
use App\Services\SettingConfigService;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;

class IndexController extends Controller
{
    public function index(){
        $user = Auth::guard('admin')->user();

        $adminNavModel = new AdminNav();
        $adminNav = $adminNavModel->getTreeData('level', 'order');

        return view('admin.index.index', [
            'admin' => $user,
            'adminNav' => $adminNav
        ]);
    }

    public function main(){

        $envs = [
            ['name' => 'PHP version',       'value' => 'PHP/'.PHP_VERSION],
            ['name' => 'Laravel version',   'value' => app()->version()],
            ['name' => 'CGI',               'value' => php_sapi_name()],
            ['name' => 'Uname',             'value' => php_uname()],
            ['name' => 'Server',            'value' => array_get($_SERVER, 'SERVER_SOFTWARE')],

            ['name' => 'Cache driver',      'value' => config('cache.default')],
            ['name' => 'Session driver',    'value' => config('session.driver')],
            ['name' => 'Queue driver',      'value' => config('queue.default')],

            ['name' => 'Timezone',          'value' => config('app.timezone')],
            ['name' => 'Locale',            'value' => config('app.locale')],
            ['name' => 'Env',               'value' => config('app.env')],
            ['name' => 'URL',               'value' => config('app.url')],
        ];
        return view('admin.index.main',compact('envs'));
    }

}
